import demo.MySingleList;

/**
 * 2023-11-28-面试题复敲
 */
public class Test {
    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(44);
        mySingleList.addLast(44);
        mySingleList.addLast(44);
        mySingleList.addLast(55);
        mySingleList.addLast(66);
        mySingleList.display();

        MySingleList.ListNode ret = mySingleList.partition(30);
        mySingleList.display();
    }
    public static void main4(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(4);
        mySingleList.addLast(5);
        mySingleList.display();

        MySingleList mySingleList2 = new MySingleList();
        mySingleList2.addLast(1);
        mySingleList2.addLast(3);
        mySingleList2.addLast(4);
        mySingleList2.display();

        MySingleList.ListNode ret = mySingleList.mergeTwoLists(mySingleList.head,mySingleList2.head);
        mySingleList.display(ret);
    }
    public static void main3(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(5);
        mySingleList.display();

        int ret = mySingleList.kthToLast(100);
        System.out.println(ret);

    }
    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.display();

        MySingleList.ListNode ret = mySingleList.middleNode();
        System.out.println(ret.val);
        mySingleList.display(ret);
    }
    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(5);
        mySingleList.display();

        mySingleList.reverseList();
        mySingleList.display();
    }
}
